package converter;

import utils.PointsUtils;

import java.io.File;
import java.io.IOException;
import java.util.List;

/**
 * Created by Сергей on 09.09.2014.
 */
public class Main {

    public static void main( String[] args ) throws IOException {

        // write your code here
        PointConverter pointConverter = new PointConverterImp();

        File fileName = new File( "D://sample.wpt" );

        List<Point> pointList = pointConverter.convertFromFile( fileName );

        System.out.println(pointList.get( 0 ).getName());



        PointsUtils pointsUtils = PointsUtils.getInstansPointUtils();

        Point nePoint = new PointImplementation();

        nePoint.setLatitude( 50.0 );

        nePoint.setLongitude( 24.0 );

        Point swPoint = new PointImplementation();

        swPoint.setLatitude( 49.0);

        swPoint.setLongitude( 23.0);



        List<Point> pointsInRectangl =

                    pointsUtils.selectPointsInRectangle( pointList, nePoint, swPoint );

        int i = 0;

        for ( Point p : pointsInRectangl){

        i++;

        System.out.println( i );

        System.out.println( p.getName() );

        }
    }
}
